from datetime import datetime
from typing import List, Dict, Any, Optional
from qwen3_agent_function_calling.tools.Tool import Tool

class DatetimeTool(Tool):
    """时间查询工具"""

    def get_name(self) -> str:
        return "get_datetime"

    def get_description(self) -> str:
        return "获取当前日期时间，无需参数"

    def execute(self, arguments: Dict[str, Any]) -> str:
        now = datetime.now()
        weekday = ["一", "二", "三", "四", "五", "六", "日"][now.weekday()]
        return f"当前时间：{now.strftime('%Y年%m月%d日 %H:%M:%S')}（星期{weekday}）"
